package com.fbs.wowo.forum.mapper;

import com.fbs.wowo.forum.entity.Reply;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

public interface ReplyMapper {
    @Delete({
        "delete from reply",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @InsertProvider(type=ReplySqlProvider.class, method="insertSelective")
    int insertSelective(Reply record);

    @Select({
        "select",
        "id, comment_id, reply_id, reply_time, from_id, to_id, status, content",
        "from reply",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="comment_id", property="commentId", jdbcType=JdbcType.VARCHAR),
        @Result(column="reply_id", property="replyId", jdbcType=JdbcType.VARCHAR),
        @Result(column="reply_time", property="replyTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="from_id", property="fromId", jdbcType=JdbcType.VARCHAR),
        @Result(column="to_id", property="toId", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="content", property="content", jdbcType=JdbcType.LONGVARCHAR)
    })
    Reply selectByPrimaryKey(String id);

    @UpdateProvider(type=ReplySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Reply record);

}